package main

import (
	"flag"
	"fmt"
	"go-caipu/pkg/services/sqlstore/migrations/util"
	"image/color"
	"path/filepath"

	"go-caipu/pkg/infra/avatarbuilder"
	"go-caipu/pkg/infra/avatarbuilder/calc"
)

var colors = []uint32{
	0xff6200, 0x42c58e, 0x5a8de1, 0x785fe0,
}

func main() {
	flag.Parse()

	// init avatarbuilder, you need to tell builder ttf file and how to alignment text
	path := filepath.Join(util.GetProgramPath(), "/resources/font/SourceHanSansSC-Medium.ttf")
	ab := avatarbuilder.NewAvatarBuilder(path, &calc.SourceHansSansSCMedium{})
	ab.SetBackgroundColorHex(colors[3])
	ab.SetFrontgroundColor(color.White)
	ab.SetFontSize(80)
	ab.SetAvatarSize(200, 200)
	if err := ab.GenerateImageAndSave("中文张三李四3", "./avatar.png"); err != nil {
		fmt.Println(err)
		return
	}
}
